// Vue
import Vue from 'vue'
import App from './App'
// store
import store from '@/store/index'
// 多国语
import i18n from './i18n'
// 核心插件
import d2Admin from '@/plugin/d2admin'

// 菜单和路由设置
import router from './router'
// import menuHeader from '@/menu/header'
// import menuAside from '@/menu/aside'
import {
    frameInRoutes
} from '@/router/routes'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import D2Crud from '@d2-projects/d2-crud'
import SplitPane from 'vue-splitpane'
import D2TreeCrud from '@/pages/components/treeTableCrud'

import {
    Menu
} from '@api/sys.menu'
import TreeUtil from '@/libs/tree'

// 核心插件
Vue.use(d2Admin)
Vue.use(ElementUI)
Vue.use(D2Crud)
Vue.component('SplitPane', SplitPane)
Vue.use(D2TreeCrud)

new Vue({
    router,
    store,
    i18n,
    render: h => h(App),
    created() {
        // 处理路由 得到每一级的路由设置
        this.$store.commit('d2admin/page/init', frameInRoutes)
    },
    mounted() {
        // 展示系统信息
        this.$store.commit('d2admin/releases/versionShow')
        // 用户登录后从数据库加载一系列的设置
        this.$store.dispatch('d2admin/account/load')
        // 获取并记录用户 UA
        this.$store.commit('d2admin/ua/get')
        // 初始化全屏监听
        this.$store.dispatch('d2admin/fullscreen/listen')
    }
}).$mount('#app')
